package com.jlect.swebing.renderers.gwt.client;

import com.jlect.swebing.renderers.client.DefaultRenderers;
import com.jlect.swebing.renderers.client.Renderer;
import com.jlect.swebing.renderers.client.RenderersFactory;

/**
 * Creates gwt renderers for the swingWT library.
 * @author Sergey Kozmin
 * @since 11.11.2007 20:34:18
 */
public class GWTRenderersFactory implements RenderersFactory {
    public Renderer createComponentRenderer(String componentId) {
        Renderer ret;
        if(DefaultRenderers.INPUT_BASED_BUTTON.getName().equalsIgnoreCase(componentId)) {
            ret = new ButtonRendererGWTImpl(); 
        } else if(DefaultRenderers.ROOT_PANEL.getName().equalsIgnoreCase(componentId)) {
            ret = new RootPanelRendererGWTImpl();
        } else if(DefaultRenderers.PANEL.getName().equalsIgnoreCase(componentId)) {
            ret = new ContainerRendererGWTImpl();
        } else if(DefaultRenderers.LABEL.getName().equalsIgnoreCase(componentId)) {
            ret = new LabelRendererGWTImpl();
        } else if(DefaultRenderers.CHECKBOX.getName().equalsIgnoreCase(componentId)) {
            ret = new CheckboxRendererGWTImpl();
        } else if(DefaultRenderers.TEXTFIELD.getName().equalsIgnoreCase(componentId)) {
            ret = new TextFieldRendererGWTImpl();
        } else if(DefaultRenderers.TEXTFIELD.getName().equalsIgnoreCase(componentId)) {
            ret = new TextAreaRendererGWTImpl();
        } else if(DefaultRenderers.PASSWORD_FIELD.getName().equalsIgnoreCase(componentId)) {
            ret = new PasswordFieldRendererGWTImpl();
        } else if(DefaultRenderers.POPUP_PANEL.getName().equalsIgnoreCase(componentId)) {
            ret = new PopupContainerRendererGWTImpl();
        } else {
            throw new IllegalArgumentException("There is no renderer for the [" + componentId + "] component.");
        }
        return ret;
    }
}
